Release 10.1A: OpenEdge Development:
AppBuilder
Operating a basic combo box
Thebasic combo box widget consists of a joined fill-in and selection list. You can manipulate the contents of the list under program control.
Clearing the list buffer
The list of items is stored as a string, pointed at by the
LIST-ITEMSattribute. You can clear the list by assigning the empty string:
Setting
Caution: The combo box widget is created with a single item in its list. You should always clear that item as part of your initialization process.LIST-ITEMSto the empty string clears the buffer immediately.You can also use a loop to delete the line items one by one:
In the example code, the
DELETEmethod is called in aWHILEloop to repeatedly delete line item 1. When the buffer is empty of lines,DELETEwill returnFALSEand theWHILEloop will terminate.Adding a line item
Using the
INSERT()method, you can add a line item at any offset in the list, regardless of the Sort option.The
ADD-FIRST()andADD-LAST()methods have a different result depending on whether the Sort option is set. If the option is not set, new items will be added to the top or bottom of the list, depending on which method you call. If the Sort option is set, new items will be inserted in sorted order regardless of which method you call.The
INSERT(),ADD-FIRST()andADD-LAST()methods all returnTRUEif they succeed,FALSEif they cannot perform the insertion:If you are adding item/value pairs, you can only add one line per call.
Adding a user-supplied line item
Although a combo box appears to be a combined fill-in and list, you cannot capture user input as new items. The fill-in’s function is only to provide a way to select a list item other than by scrolling to find it.
To allow the user to add items to the list, use a separate fill-in to capture the text for the new item or item/value pair and call the appropriate insertion method to add it:
![]()
This code, if used as the
CHOOSEtrigger for thepbAppendpushbutton, will move non-empty strings from the fill-in to the list in the combo box:
Deleting a line from the list
Deleting a line requires only that you know the line number. This code will delete line 5 if it exists:
Finding a line or item in the list
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |